<template>
	<l-page :page.sync="queryParams.pageNum" :page-size.sync="queryParams.pageSize" :total="total" @getList="getList">
		<el-form ref="queryForm" slot="header" :model="queryParams" :inline="true" label-position="right" label-width="90px">
			<el-form-item label="用户ID:" prop="uuid">
				<el-input v-model.trim="queryParams.uuid" placeholder="请输入用户ID" maxlength="6" show-word-limit clearable @input="numValid('userId')" />
			</el-form-item>
			<el-form-item label="手机号码:" prop="mobile">
				<el-input v-model.trim="queryParams.mobile" placeholder="请输入手机号码" maxlength="11" clearable show-word-limit />
			</el-form-item>
			<el-form-item label="供应商名称:" prop="username">
				<el-input v-model.trim="queryParams.username" placeholder="请输入供应商名称" clearable />
			</el-form-item>
			<!--			<el-form-item label="审核状态:" prop="approvalStatus">-->
			<!--				<el-select v-model="queryParams.approvalStatus" placeholder="请选择审核状态">-->
			<!--					<el-option v-for="item in approvalStatus" :key="item.value" :label="item.label" :value="item.value"> </el-option>-->
			<!--				</el-select>-->
			<!--			</el-form-item>-->
			<el-form-item label="供应商状态:" prop="status">
				<el-select v-model="queryParams.status" placeholder="请选择供应商状态">
					<el-option label="全部" :value="null"> </el-option>
					<el-option label="正常" value="0"> </el-option>
					<el-option label="禁用" value="1"> </el-option>
				</el-select>
			</el-form-item>
			<start-end-time ref="child" :get-time="getTime" title="申请时间:"></start-end-time>
		</el-form>
		<div slot="card" class="mb-[24px] flex items-center">
			<l-statistical-card left-name="供应商总数" :left-value="supplierStatics.totalCount" :right-value="supplierStatics.lastTotalCount" />
			<l-statistical-card left-name="禁用供应商" :left-value="supplierStatics.disableCount" :right-value="supplierStatics.lastDisableCount" />
			<!--			<l-statistical-card left-name="待审核总数" :left-value="supplierStatics.auditCount" :right-value="supplierStatics.lastAuditCount" />-->
			<l-statistical-card left-name="货款总数" :left-value="supplierStatics.amount" :right-value="supplierStatics.lastAmount" />
		</div>
		<template slot="options">
			<l-search @search="handleQuery" @refresh="resetQuery" />
			<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增 </el-button>
			<el-button type="primary" @click="handleExport">
				<svg-icon icon-class="export" size="16px"></svg-icon>
				导出
			</el-button>
		</template>

		<el-table v-loading="loading" stripe :data="supplierList" @selection-change="handleSelectionChange" @sort-change="handleSortChange">
			<!-- <el-table-column :formatter="emptyToString" type="selection" width="55" align="center" /> -->
			<el-table-column :formatter="emptyToString" label="序号" align="center" type="index" />
			<el-table-column :formatter="emptyToString" label="用户ID" align="center" prop="uuid" min-width="120" />
			<el-table-column :formatter="emptyToString" label="手机号码" align="center" prop="mobile" min-width="120"> </el-table-column>
			<el-table-column min-width="120" :formatter="emptyToString" label="供应商名称" align="center" sortable prop="username" />
			<el-table-column min-width="120" :formatter="emptyToNumber" label="货款" align="center" sortable prop="supplierEarnings" />
			<el-table-column min-width="200" :formatter="emptyToString" label="省市区" align="center">
				<template slot-scope="scope"> {{ scope.row.provinceName }}{{ scope.row.cityName }}{{ scope.row.countyName }} </template>
			</el-table-column>
			<el-table-column min-width="156" label="详细地址" align="center" prop="address">
				<template slot-scope="scope">
					<div class="multi-line" style="min-width: 80px" v-text="scope.row.address || '-'"></div>
				</template>
			</el-table-column>
			<el-table-column min-width="120" :formatter="emptyToString" label="供应商状态" align="center" prop="status">
				<template slot-scope="scope">
					<el-switch
						v-model.trim="scope.row.status"
						:disabled="scope.row.approvalStatus != 1"
						:active-value="0"
						:inactive-value="1"
						active-text="正常"
						inactive-text="禁用"
						class="switch"
						@change="statusChange($event, scope.row)"
					></el-switch>
				</template>
			</el-table-column>
			<!--			<el-table-column :formatter="emptyToString" align="center" label="审核状态" prop="approvalStatus" min-width="156">-->
			<!--				<template slot-scope="scope">{{ scope.row.approvalStatus | approvalStatus }}</template>-->
			<!--			</el-table-column>-->
			<el-table-column :formatter="emptyToString" align="center" label="申请时间" min-width="200" prop="createTime">
				<template slot-scope="scope">
					<div class="w-full flex flex-col items-center">
						<span>{{ dayjs(scope.row.createTime).format('YYYY-MM-DD') }}</span>
						<span>{{ dayjs(scope.row.createTime).format('HH:mm:ss') }}</span>
					</div>
				</template>
			</el-table-column>
			<el-table-column :formatter="emptyToString" label="操作" align="left" fixed="right" header-align="center" :width="tableAction">
				<template slot-scope="scope">
					<div class="table-action">
						<el-button v-if="scope.row.approvalStatus === 1" v-hasPermi="['mall:supplier:edit']" type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
						<el-button v-if="scope.row.approvalStatus === 1" v-hasPermi="['mall:supplier:detail']" type="primary" @click="showDetails(scope.row.id)">详情</el-button>
						<!--						<el-button v-if="scope.row.approvalStatus === 0" v-hasPermi="['mall:supplier:audit']" type="primary" @click="supplier(scope.row)">审核</el-button>-->
						<el-button v-if="scope.row.approvalStatus === 2 || scope.row.approvalStatus === 1" v-hasPermi="['mall:supplier:remove']" type="danger" @click="handleDelete(scope.row)">删除</el-button>
					</div>
				</template>
			</el-table-column>
		</el-table>

		<!-- 添加或编辑供应商对话框 -->
		<l-dialog v-model="open" :title="title" width="764px" class="supplier" @formSubmit="submitForm" @formClose="cancel">
			<el-form ref="form" :model="form" :rules="rules" label-width="110px" label-position="left">
				<el-form-item label="用户ID:" prop="uuid">
					<el-input v-model.trim="form.uuid" placeholder="请输入用户ID" class="!w-[225px]" maxlength="6" show-word-limit />
				</el-form-item>
				<el-form-item label="供应商名称:" prop="username">
					<el-input v-model.trim="form.username" placeholder="请输入供应商名称" class="!w-[225px]" maxlength="10" show-word-limit />
				</el-form-item>
				<div class="province flex">
					<el-form-item label="省:" prop="province" class="mr-[40px]">
						<el-select v-model="form.province" placeholder="请输入省" class="!w-[126px]" @change="areaChange">
							<el-option v-for="areas in area" :key="areas.objId" :label="areas.name" :value="areas.objId" />
						</el-select>
					</el-form-item>
					<el-form-item label="市:" label-width="60px" prop="city" class="mr-[40px]">
						<el-select v-model="form.city" placeholder="请输入市" class="!w-[126px]" @change="districtAddress">
							<el-option v-for="item in municipalAddress" :key="item.objId" :label="item.name" :value="item.objId" />
						</el-select>
					</el-form-item>
					<el-form-item label="区/县:" label-width="80px" prop="county" class="mr-[40px]">
						<el-select v-model="form.county" placeholder="请输入区/县" class="!w-[126px]">
							<el-option v-for="item in district" :key="item.objId" :label="item.name" :value="item.objId" />
						</el-select>
					</el-form-item>
				</div>

				<el-form-item label="详细地址:" prop="address">
					<el-input v-model.trim="form.address" placeholder="请输入供应商详细地址" class="!w-full !max-w-full" />
				</el-form-item>
				<el-form-item label="登录密码:" prop="password">
					<el-input v-model.trim="form.password" class="!w-[225px]" type="password" placeholder="请输入登录密码" />
				</el-form-item>
				<el-form-item label="确认密码:" prop="twoPassword">
					<el-input v-model.trim="form.twoPassword" class="!w-[225px]" type="password" placeholder="请再次输入登录密码" />
				</el-form-item>
				<!--				<el-form-item label="营业执照:" class="el-left" prop="businessLicense">-->
				<!--					<l-upload-image v-model="form.businessLicense" height="104px" width="199px" :limit="1" class="w-full">-->
				<!--						<div class="flex flex-col items-center">-->
				<!--							<svg-icon icon-class="add" size="20px" color="#CCCCCC" class="mb-[8px]"></svg-icon>-->
				<!--							<div class="text-[12px] text-[#F14A46] cursor-pointer">上传营业执照</div>-->
				<!--						</div>-->
				<!--					</l-upload-image>-->
				<!--				</el-form-item>-->
				<el-form-item label="身份证图片:" prop="frontOfIdCard" class="el-left">
					<div class="flex">
						<el-form-item label-width="0" class="mr-[16px]" prop="frontOfIdCard">
							<l-upload-image v-model="form.frontOfIdCard" height="104px" width="199px" :limit="1" class="w-full">
								<div class="flex flex-col items-center">
									<svg-icon icon-class="add" size="20px" color="#CCCCCC" class="mb-[8px]"></svg-icon>
									<div class="text-[12px] text-[#F14A46] cursor-pointer">上传身份证人像面</div>
								</div>
							</l-upload-image>
						</el-form-item>
						<el-form-item label-width="0" prop="backOfIdCard">
							<l-upload-image v-model="form.backOfIdCard" height="104px" width="199px" :limit="1" class="w-full">
								<div class="flex flex-col items-center">
									<svg-icon icon-class="add" size="20px" color="#CCCCCC" class="mb-[8px]"></svg-icon>
									<div class="text-[12px] text-[#F14A46] cursor-pointer">上传身份证国徽面</div>
								</div>
							</l-upload-image>
						</el-form-item>
					</div>
				</el-form-item>
			</el-form>
		</l-dialog>

		<el-dialog :title="title" :visible.sync="account" width="500px" append-to-body style="margintop: 100px">
			<el-form ref="form" :model="form" :rules="update" label-width="120px">
				<el-form-item label="供应商名称:" prop="username">
					<el-input v-model.trim="form.username" placeholder="请输入供应商名称" />
				</el-form-item>
				<el-form-item label="供应商账号:" prop="account">
					<el-input v-model.trim="form.account" placeholder="请输入供应商手机号码" />
				</el-form-item>
				<el-form-item label="登录密码:" prop="password">
					<el-input v-model.trim="form.password" placeholder="请输入供应商密码" />
				</el-form-item>
				<el-form-item label="确认密码:" prop="twoPassword">
					<el-input v-model.trim="form.twoPassword" placeholder="请再次输入供应商密码" />
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="resetAccount">保 存</el-button>
				<el-button @click="resetAccountCancel">取 消</el-button>
			</div>
		</el-dialog>

		<l-dialog v-model="openDetails" title="详情" width="730px" :show-button="false" ok-button-text="退出" class="supplierDetails" @formSubmit="openDetails = false">
			<el-form label-position="left" label-width="100px" disabled>
				<el-form-item label="用户ID:">
					<el-input :value="info.uuid" />
				</el-form-item>
				<el-form-item label="供应商名称:">
					<el-input :value="info.username" />
				</el-form-item>
				<el-form-item label="手机号码:">
					<el-input :value="info.mobile" />
				</el-form-item>
				<el-form-item label="详细地址:">
					<el-input :value="(info.provinceCityDistrict || '') + info.address" class="!w-full !max-w-full" />
				</el-form-item>
				<el-form-item label="身份证图片:">
					<div class="flex w-full">
						<el-image class="!w-[199px] !h-[104px] mr-[16px] rounded-[8px]" :z-index="9999" :src="info.frontOfIdCard" :preview-src-list="[info.frontOfIdCard]"> </el-image>
						<el-image class="!w-[199px] !h-[104px] rounded-[8px]" :z-index="9999" :src="info.backOfIdCard" :preview-src-list="[info.backOfIdCard]"> </el-image>
					</div>
				</el-form-item>
				<el-form-item label="营业执照:">
					<div class="flex w-full">
						<el-image class="!w-[199px] !h-[104px] mr-[16px] rounded-[8px]" :z-index="9999" :src="info.businessLicense" :preview-src-list="[info.businessLicense]"> </el-image>
					</div>
				</el-form-item>
			</el-form>
		</l-dialog>

		<l-dialog
			v-model="audit"
			title="审核"
			on-button-width="236px"
			close-button-width="236px"
			width="730px"
			ok-button-text="通过"
			close-button-text="拒绝"
			@formSubmit="auditsupplier(1, info.id)"
			@formClose="auditsupplier(0, info.id)"
		>
			<el-form label-position="left" label-width="100px" disabled>
				<el-form-item label="用户ID:">
					<el-input :value="info.uuid" />
				</el-form-item>
				<el-form-item label="供应商名称:">
					<el-input :value="info.username" />
				</el-form-item>
				<el-form-item label="手机号码:">
					<el-input :value="info.mobile" />
				</el-form-item>
				<el-form-item label="详细地址:">
					<el-input :value="(info.provinceCityDistrict || '') + info.address" class="!w-full !max-w-full" />
				</el-form-item>
				<el-form-item label="身份证图片:">
					<div class="flex w-full">
						<el-image class="!w-[199px] !h-[104px] mr-[16px] rounded-[8px]" :z-index="9999" :src="info.frontOfIdCard" :preview-src-list="[info.frontOfIdCard]"> </el-image>
						<el-image class="!w-[199px] !h-[104px] rounded-[8px]" :z-index="9999" :src="info.backOfIdCard" :preview-src-list="[info.backOfIdCard]"> </el-image>
					</div>
				</el-form-item>
				<el-form-item label="营业执照:">
					<div class="flex w-full">
						<el-image class="!w-[199px] !h-[104px] mr-[16px] rounded-[8px]" :z-index="9999" :src="info.businessLicense" :preview-src-list="[info.businessLicense]"> </el-image>
					</div>
				</el-form-item>
			</el-form>
		</l-dialog>
	</l-page>
</template>

<script>
import {
	listsupplier,
	getsupplier,
	delsupplier,
	addsupplier,
	updatesupplier,
	exportsupplier,
	getUserList,
	getArea,
	municipalAddress,
	getCity,
	forgetPassword,
	auditSupplier,
	querySupplierStatics,
} from '@/api/mall/supplier';
import debounce from 'lodash/debounce';
import tableMixins from '@/mixins/table';
const approvalStatus = [
	{
		label: '待审核',
		value: 0,
	},
	{
		label: '审核成功',
		value: 1,
	},
	{
		label: '审核失败',
		value: 2,
	},
];

export default {
	name: 'Supplier',
	components: {},
	filters: {
		approvalStatus(type) {
			for (let i = 0; i < approvalStatus.length; i++) {
				if (type === approvalStatus[i].value) {
					return approvalStatus[i].label;
				}
			}
			return '';
		},
	},
	mixins: [tableMixins],
	data() {
		return {
			tableAction: 100,
			// 遮罩层
			loading: true,
			// 选中数组
			ids: [],
			// 非单个禁用
			single: true,
			// 非多个禁用
			multiple: true,
			// 显示搜索条件
			showSearch: true,
			// 总条数
			total: 0,
			// 供应商表格数据
			supplierList: [],
			//供应商选项
			userOptions: [],
			area: [],
			municipalAddress: [],
			district: [],
			// 弹出层标题
			title: '',
			info: {},
			openDetails: false,
			// 是否显示弹出层
			open: false,
			account: false,
			audit: false,
			// 搜索参数
			queryParams: {
				pageNum: 1,
				pageSize: 10,
				id: null,
				uuid: null,
				username: null,
				mobile: null,
				approvalStatus: null,
				status: null,
			},
			// 表单参数
			form: {},
			update: {
				username: [{ required: true, message: '供应商名称不能为空', trigger: 'blur' }],
				password: [{ required: true, message: '供应商密码不能为空', trigger: 'blur' }],
				twoPassword: [{ required: true, message: '供应商密码不能为空', trigger: 'blur' }],
				account: [
					{
						required: true,
						message: '供应商手机号码不能为空',
						trigger: 'blur',
					},
				],
			},
			// 表单校验
			rules: {
				uuid: [{ required: true, message: '请输入用户ID', trigger: 'blur' }],
				businessLicense: [{ required: true, message: '请上传营业执照', trigger: 'change' }],
				username: [{ required: true, message: '请输入供应商名称', trigger: 'blur' }],
				password: [{ required: true, message: '请输入登录密码', trigger: 'blur' }],
				twoPassword: [{ required: true, message: '请输入确认密码', trigger: 'blur' }],
				frontOfIdCard: [
					{
						required: true,
						message: '请上传身份证人像面',
						trigger: 'change',
					},
				],
				backOfIdCard: [
					{
						required: true,
						message: '请上传身份证国徽面',
						trigger: 'change',
					},
				],
				province: [{ required: true, message: '省份不能为空', trigger: 'blur' }],
				city: [{ required: true, message: '市区不能为空', trigger: 'blur' }],
				county: [{ required: true, message: '区县不能为空', trigger: 'blur' }],
				address: [
					{
						required: true,
						message: '供应商详细地址不能为空',
						trigger: 'blur',
					},
				],
				lastLoginIp: [
					{
						required: true,
						message: '最近一次登录IP地址不能为空',
						trigger: 'blur',
					},
				],
				mobile: [
					{
						required: true,
						message: '供应商手机号码不能为空',
						trigger: 'blur',
					},
				],
				weixinOpenid: [
					{
						required: true,
						message: '微信登录openid不能为空',
						trigger: 'blur',
					},
				],
				sessionKey: [
					{
						required: true,
						message: '微信登录会话KEY不能为空',
						trigger: 'blur',
					},
				],
				status: [
					{
						required: true,
						message: '0 可用, 1 禁用, 2 注销不能为空',
						trigger: 'blur',
					},
				],
			},
			approvalStatus: [
				{ label: '全部', value: null },
				{ label: '待审核', value: 0 },
				{ label: '审核成功', value: 1 },
				{ label: '审核失败', value: 2 },
			],
			supplierStatics: {
				amount: 0,
				auditCount: 0,
				disableCount: 0,
				lastAmount: 0,
				lastAuditCount: 0,
				lastDisableCount: 0,
				lastTotalCount: 0,
				totalCount: 0,
			},
		};
	},
	created() {
		this.getList();
		this.querySupplierStatics();
	},
	methods: {
		getTime(startTime, endTime) {
			this.queryParams.startTime = startTime;
			this.queryParams.endTime = endTime;
		},
		querySupplierStatics() {
			querySupplierStatics().then((res) => {
				this.supplierStatics = res.data;
			});
		},
		numValid(val) {
			//只能输入数字
			this.queryParams[val] = this.queryParams[val].replace(/[^0-9]/g, '');
		},
		handleClose() {
			this.openDetails = false;
		},
		auditsupplier(event, row) {
			auditSupplier({
				id: row,
				type: event,
			}).then(() => {
				if (event === 1) {
					this.msgSuccess('已通过该审核');
				} else {
					this.msgSuccess('已驳回该审核');
				}
				this.audit = false;
				this.getList();
			});
		},

		areaChange(event) {
			this.$set(this.form, 'city', '');
			this.$set(this.form, 'county', '');
			municipalAddress({
				id: event,
			}).then((response) => {
				this.municipalAddress = response.data;
			});
		},

		districtAddress(event) {
			this.$set(this.form, 'county', '');
			municipalAddress({
				id: event,
			}).then((response) => {
				this.district = response.data;
			});
		},

		showDetails(id) {
			getsupplier(id).then((response) => {
				this.info = response.data;
				this.openDetails = true;
			});
		},

		statusChange(event, row) {
			this.loading = true;
			updatesupplier({
				id: row.id,
				status: event,
			}).then(() => {
				this.msgSuccess('编辑成功');
				this.getList();
			});
		},
		getList() {
			this.loading = true;
			listsupplier(this.queryParams)
				.then((response) => {
					console.log(response.data);
					this.supplierList = response.data.records;
					this.total = response.data.total;
					this.setActionWidth();
				})
				.finally(() => {
					this.loading = false;
				});
		},

		// 取消按钮
		cancel() {
			this.open = false;
			this.reset();
		},

		resetAccountCancel() {
			this.account = false;
		},

		// 表单重置
		reset() {
			this.form = {
				id: null,
				username: null,
				mobile: null,
				approvalStatus: null,
				weixinOpenid: null,
				sessionKey: null,
				uuid: null,
				status: 0,
				delFlag: null,
				businessLicense: null,
				createBy: null,
				createTime: null,
				updateBy: null,
				updateTime: null,
			};
			this.resetForm('form');
		},
		/** 搜索按钮操作 */
		handleQuery() {
			this.queryParams.pageNum = 1;
			this.getList();
		},
		/** 重置按钮操作 */
		resetQuery() {
			this.$refs.child.resetTime();
			this.$refs.queryForm.resetFields();
			this.handleQuery();
		},
		// 多选框选中数据
		handleSelectionChange(selection) {
			this.ids = selection.map((item) => item.id);
			this.single = selection.length !== 1;
			this.multiple = !selection.length;
		},
		/** 新增按钮操作 */
		handleAdd() {
			getUserList().then((response) => {
				this.reset();
				this.userOptions = response;
				// console.log(this.userOptions )
				this.open = true;
				this.title = '新增';
			});
			getArea().then((response) => {
				this.area = response.data;
				// console.log(response.data)
			});
		},
		/** 编辑按钮操作 */
		handleUpdate(row) {
			this.reset();
			const userId = row.id;
			getsupplier(userId).then((response) => {
				console.log(response.data, 'response.data');
				// console.log(response.data)
				this.open = true;
				this.title = '编辑';
				this.$nextTick(() => {
					this.form = response.data;
				});
			});
			console.log(row);
			getArea().then((response) => {
				this.area = response.data;
				// console.log(response.data)
			});

			getCity({ id: row.province }).then((response) => {
				this.municipalAddress = response.data;
			});
			getCity({ id: row.city }).then((response) => {
				this.district = response.data;
			});
		},

		resetPassword(row) {
			const userId = row.id;
			getsupplier(userId).then((response) => {
				this.form = response.data;
				this.account = true;
				this.title = '重置密码';
			});
		},

		supplier(row) {
			this.reset();
			const id = row.id || this.ids;
			getsupplier(id).then((response) => {
				this.info = response.data;
				this.audit = true;
				this.title = '审核';
			});
		},

		resetAccount: debounce(
			function () {
				this.$refs['form'].validate((valid) => {
					if (valid) {
						if (this.form.password.length < 6) {
							this.$message.error('密码不能小于6位数!');
							return;
						}
						if (this.form.mobile.length !== 11) {
							this.$message.error('电话号码格式有误!');
							return;
						}
						if (this.form.password !== this.form.twoPassword) {
							this.$message.error('2次密码输入不一致!');
							return;
						}
						if (this.form.id != null) {
							forgetPassword({
								userId: this.form.userId,
								password: this.form.password,
							}).then(() => {
								this.msgSuccess('编辑成功');
								this.account = false;
								this.getList();
							});
						}
					}
				});
			},
			1500,
			{
				leading: true,
				trailing: false,
			}
		),

		/** 提交按钮 */
		submitForm() {
			this.$refs['form'].validate((valid) => {
				if (valid) {
					let obj = {
						...this.form,
					};
					if (this.form.password != null && this.form.password.length > 0) {
						if (this.form.password.length < 6) {
							this.$message.error('密码不能小于6位数!');
							return;
						}
						if (this.form.password !== this.form.twoPassword) {
							this.$message.error('2次密码输入不一致!');
							return;
						}
					}
					if (this.form.id != null) {
						obj.id = this.form.id;
						updatesupplier(obj).then(() => {
							if (this.form.password) {
								forgetPassword({
									userId: this.form.userId,
									password: this.form.password,
								}).then(() => {});
							}
							this.msgSuccess('编辑成功');
							this.open = false;
							this.getList();
						});
					} else {
						addsupplier(obj).then(() => {
							this.msgSuccess('新增成功');
							this.open = false;
							this.getList();
						});
					}
				}
			});
		},
		/** 删除按钮操作 */
		handleDelete(row) {
			const ids = row.id ? [row.id] : this.ids;
			this.$confirm('是否删除供应商id"' + row.uuid + '"的供应商?', '警告', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning',
			})
				.then(function () {
					return delsupplier(ids);
				})
				.then(() => {
					this.getList();
					this.msgSuccess('删除成功');
				});
		},
		/** 导出按钮操作 */
		handleExport() {
			const queryParams = this.queryParams;
			this.$confirm('是否确认导出所有供应商数据项?', '警告', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning',
			})
				.then(function () {
					return exportsupplier(queryParams);
				})
				.then((response) => {
					this.download(response.msg);
				});
		},
		handleCommand(key, row) {
			this[key](row);
		},
	},
};
</script>
<style scoped lang="scss">
::v-deep .elx-imgbox .elx-images .el-upload-list__item,
.elx-imgbox .elx-images .el-upload--picture-card {
	width: 280px !important;
}
::v-deep .el-upload--picture-card {
	width: 280px !important;
}
.btn-box {
	display: flex;
	justify-content: center;
	margin-top: 40px;

	.btn {
		padding: 0;
		font-size: 18px;
		width: 236px;
		height: 60px;
		opacity: 1;
		border-radius: 4px;
		line-height: 60px;
	}
}
.content {
	.content-info {
		.image__preview {
			display: flex;
			justify-content: center;
			.image {
				width: 329px;
				height: 162px;
				margin: 0 10px;
				display: block;
				border-radius: 8px;
			}
		}
		.info {
			display: flex;
			margin-bottom: 25px;

			> div {
				width: 50%;
				height: 40px;
				line-height: 40px;
				display: flex;
				color: #333333;
				justify-content: center;
				.label {
					width: 85px;
					font-size: 12px;
				}
				.text {
					width: 225px;
					background: #f7f7f7;
					font-size: 14px;
					box-sizing: border-box;
					padding-left: 12px;
				}
			}
		}
		.info-plus {
			> div {
				width: 100%;
				.text {
					width: 593px;
				}
			}
		}
	}
}
.supplier {
	::v-deep {
		.modal-footer-btn {
			width: 236px !important;
			flex: 0 0 236px;
		}
	}
}
.supplierDetails {
	::v-deep {
		.modal-footer-btn {
			width: 416px !important;
			flex: 0 0 416px;
		}
	}
}
.province {
	::v-deep .el-input {
		width: 124px !important;
		max-width: 124px !important;
	}
}
</style>
